package org.geektimes.projects.user.web.listener;


import org.apache.activemq.command.ActiveMQTextMessage;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.jms.MessageProducer;
import javax.jms.TextMessage;
import javax.jms.Topic;

/**
 * @Author: jipeng
 * @Description:
 * @Date: Created in 2021/4/1 6:48
 */
@Deprecated
public class TestingComponent {

    @Resource(name = "jms/activemq-topic")
    private Topic topic;

//    @Resource(name = "jms/message-producer")
//    private MessageProducer messageProducer;


    @PostConstruct
    public void init(){

        System.out.println(topic);
    }


    @PostConstruct
    public void sendMessage() throws Throwable{
        // Create a messages
        String text = "Hello world! From: " + Thread.currentThread().getName() + " : " + this.hashCode();
        //创建消息
        ActiveMQTextMessage message = new ActiveMQTextMessage();
        message.setText(text);

//        //发送消息
//        messageProducer.send(message);

//        System.out.printf("producer ======= [Thread : %s] Sent message : %s\n", Thread.currentThread().getName(), message.getText());





    }


}
